package com.sxz.sbs.module.client.presenter;

import com.sxz.sbs.app.App;
import com.sxz.sbs.module.client.view.AddUserAccountView;
import com.sxz.sbs.rx.RxPresenter;
import com.sxz.sbs.rx.RxSubscriber;
import com.sxz.sbs.rx.RxUtil;

import java.util.HashMap;

/**
 * 新增车位
 * @author hp
 */
public class AddUserAccountPresenter extends RxPresenter<AddUserAccountView> {

    public void getVerifyCode (HashMap<String,Object> map) {
        addSubscribe(App.getInstance().getApi().getMessageCode(map)
                .compose(RxUtil.<String>handleResult())
                .subscribeWith(new RxSubscriber<String>(mView,true){
                    @Override
                    public void onNext(String data) {
                        mView.onGetCodeSuccess();
                    }
                })
        );
    }

    public void getAddUserAccount (HashMap<String,Object> map) {
        addSubscribe(App.getInstance().getApi().getRegister(map)
                .compose(RxUtil.<String>handleResult())
                .subscribeWith(new RxSubscriber<String>(mView,true){
                    @Override
                    public void onNext(String data) {
                        mView.onGetAddUserAccount();
                    }
                })
        );
    }
}
